import java.util.Scanner;
public class tless {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for(int i = 1; i <= n; i++) {
            int x =Solution(sc.nextInt());
            System.out.println(x);
        }
    }

    private static int Solution(int i) {
        if (i == 1|| i == 2 || i == 0){
            return i;
        }
        return Solution(i-3) + Solution(2)+Solution(1) ;


        //System.out.println();
    }
}